package hcn.protocol.brandnew.zhenliao.yaopin;

import com.fasterxml.jackson.annotation.JsonFormat;
import ctd.util.xml.jaxb.DateTimeAdapter;
import lombok.Data;
import org.atag.sysrouter.annotation.DictionaryMapping;

import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.List;


/**
 * 历史处方查询-响应消息（成功） - ODS_03040004_SUC
 *
 * @author enjoyLife
 */
@Data
@XmlRootElement(name = "Data")
@XmlAccessorType(XmlAccessType.FIELD)
public class GetHistoryPrescriptionResponse {

    /**
     * 处方信息
     */
    @XmlElementWrapper(name = "PrescriptionLists")
    @XmlElement(name = "PrescriptionList")
    private List<PrescriptionList> prescriptionLists;

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Patient {

        /**
         * 就诊医疗机构组织机构代码
         */
        @XmlElement(name = "VisitOrganization")
        private String visitOrganization;
        /**
         * 就诊机构名称
         */
        @XmlElement(name = "VisitOrganizationName")
        private String visitOrganizationName;
        /**
         * 患者id
         */
        @XmlElement(name = "SourcePatientId")
        private String sourcePatientId;
        /**
         * 身份证件号码
         */
        @XmlElement(name = "IdCard")
        private String idCard;
        /**
         * 身份证件类别代码
         */
        @XmlElement(name = "IdCardCode")
        @DictionaryMapping(id = "CV02_01_101")
        private String idCardCode;
        /**
         * 就诊卡类别代码
         */
        @XmlElement(name = "MedicalCardType")
        private String medicalCardType;
        /**
         * 就诊卡号
         */
        @XmlElement(name = "MedicalCardID")
        private String medicalCardID;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class DiagnoseList {

        /**
         * 疾病序号
         */
        @XmlElement(name = "DiagnoseNumber")
        private String diagnoseNumber;
        /**
         * 西医诊断编码
         */
        @XmlElement(name = "DiagnoseCode")
        private String diagnoseCode;
        /**
         * 西医诊断名称
         */
        @XmlElement(name = "DiagnoseName")
        private String diagnoseName;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Visit {

        /**
         * 门（急）诊号
         */
        @XmlElement(name = "ClinicId")
        private String clinicId;
        /**
         * 住院号
         */
        @XmlElement(name = "HospizationId")
        private String hospizationId;
        /**
         * 就诊流水号
         */
        @XmlElement(name = "VisitId")
        private String visitId;
        /**
         * 科室代码
         */
        @XmlElement(name = "DeptCode")
        private String deptCode;
        /**
         * 科室名称
         */
        @XmlElement(name = "DeptName")
        private String deptName;
        /**
         * 病人诊断列表
         */
        @XmlElementWrapper(name = "DiagnoseLists")
        @XmlElement(name = "DiagnoseList")
        private List<DiagnoseList> diagnoseLists;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class PrescriptionDrugList {

        /**
         * 药品id
         */
        @XmlElement(name = "DrugsNumber")
        private String drugsNumber;
        /**
         * 药物名称
         */
        @XmlElement(name = "DrugName")
        private String drugName;
        /**
         * 处方药品组号
         */
        @XmlElement(name = "DrugsGroupNumber")
        private String drugsGroupNumber;
        /**
         * 药品顺序号
         */
        @XmlElement(name = "SortNumber")
        private String sortNumber;
        /**
         * 药品类型
         */
        @XmlElement(name = "DrugType")
        private String drugType;
        /**
         * 药品产地id
         */
        @XmlElement(name = "DrugProductionPlaceId")
        private String drugProductionPlaceId;
        /**
         * 药品-药品产地
         */
        @XmlElement(name = "DrugProductionPlace")
        private String drugProductionPlace;
        /**
         * 药物规格
         */
        @XmlElement(name = "DrugSpecifications")
        private String drugSpecifications;
        /**
         * 药房单位
         */
        @XmlElement(name = "DrugstoreUnit")
        private String drugstoreUnit;
        /**
         * 药品项目单价
         */
        @XmlElement(name = "DrugUnitPrice")
        private String drugUnitPrice;
        /**
         * 药物金额
         */
        @XmlElement(name = "DrugTotalCost")
        private String drugTotalCost;
        /**
         * 药物一次剂量
         */
        @XmlElement(name = "OnceDosage")
        private String onceDosage;
        /**
         * 剂量单位
         */
        @XmlElement(name = "DosageUnit")
        private String dosageUnit;
        /**
         * 每次药品数量
         */
        @XmlElement(name = "OnceTotalNumber")
        private String onceTotalNumber;
        /**
         * 药品数量
         */
        @XmlElement(name = "DrugSendNumber")
        private String drugSendNumber;
        /**
         * 用药天数
         */
        @XmlElement(name = "MedicineDays")
        private Byte medicineDays;
        /**
         * 药物使用频次代码
         */
        @XmlElement(name = "DrugUsingRate")
        private String drugUsingRate;
        /**
         * 使用频次名称
         */
        @XmlElement(name = "DrugUsingRateName")
        private String drugUsingRateName;
        /**
         * 药物使用途径代码
         */
        @XmlElement(name = "DrugUsePathwaysCode")
        private String drugUsePathwaysCode;
        /**
         * 使用途径名称
         */
        @XmlElement(name = "DrugUsePathwaysName")
        private String drugUsePathwaysName;
        /**
         * 代煎标志
         */
        @XmlElement(name = "BoilSign")
        private String boilSign;
        /**
         * 草药煎法代码
         */
        @XmlElement(name = "HerbalMedicineDecoction")
        private Integer herbalMedicineDecoction;
        /**
         * 草药煎法名称
         */
        @XmlElement(name = "HerbalMedicineDecoctionName")
        private String herbalMedicineDecoctionName;
        /**
         * 草药脚注
         */
        @XmlElement(name = "HerbalFootNote")
        private String herbalFootNote;
        /**
         * 草药脚注名称
         */
        @XmlElement(name = "HerbalFootNoteName")
        private String herbalFootNoteName;
        /**
         * 中药饮片剂数
         */
        @XmlElement(name = "PiecesChineseMedicineAgentNumb")
        private Byte piecesChineseMedicineAgentNumb;
        /**
         * 药品备注
         */
        @XmlElement(name = "Remark")
        private String remark;
        /**
         * 外延处方标志
         */
        @XmlElement(name = "EpitaxialSign")
        private String epitaxialSign;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Prescription {

        /**
         * 处方编号
         */
        @XmlElement(name = "RecipeNumber")
        private String recipeNumber;
        /**
         * 处方类别代码
         */
        @XmlElement(name = "RecipeTypeCode")
        private String recipeTypeCode;
        /**
         * 处方类型
         */
        @XmlElement(name = "PrescriptionType")
        private Integer prescriptionType;
        /**
         * 处方开立日期
         */
        @XmlElement(name = "AdviceOpenDateTime")
//        @XmlJavaTypeAdapter(DateTimeAdapter.class)
//        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private String adviceOpenDateTime;
        /**
         * 处方药品列表
         */
        @XmlElementWrapper(name = "PrescriptionDrugLists")
        @XmlElement(name = "PrescriptionDrugList")
        private List<PrescriptionDrugList> prescriptionDrugLists;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class PrescriptionList {

        /**
         * 患者基本信息
         */
        @XmlElement(name = "Patient")
        private Patient patient;
        /**
         * 就诊信息
         */
        @XmlElement(name = "Visit")
        private Visit visit;
        /**
         * 处方信息
         */
        @XmlElement(name = "Prescription")
        private Prescription prescription;
    }

}
